Inaccuracy tests with TRES

Basically, how bad of an approximation can we do to the interpolation and still get away with 10% accuracy to the grid points? 10K, 0.05 dex in logg and [Fe/H] ?

As a comparison we need a high quality spectrum generated using our normal interpolation methods.


In [1]:
%matplotlib
import matplotlib.pyplot as plt
import numpy as np
from StellarSpectra.spectrum import DataSpectrum
from StellarSpectra.grid_tools import TRES
from grid_accuracy import AccuracyComparison

from IPython.display import display


Using matplotlib backend: Qt4Agg

TRES Spectra


In [2]:
myDataSpectrum = DataSpectrum.open("../../data/WASP14/WASP14-2009-06-14.hdf5", orders=np.array([22]))
myInstrument = TRES()

Perturbations about T=6000, logg=4.5, Z = -0.5


In [3]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_F.hdf5",
                            "../../libraries/PHOENIX_TRES_F.hdf5",
                            {"temp":6000, "logg":4.5, "Z":-0.5}, {"temp":10, "logg":0.05, "Z": 0.05})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'alpha': (0.0, 0.0), 'temp': (5000, 7000), 'Z': (-1.0, 0.5), 'logg': (2.5, 5.5)}
LA {'alpha': (0.0, 0.0), 'temp': (5000, 6700), 'Z': (-1.0, 0.5), 'logg': (2.5, 5.0)}
Determine Chunk Log: Wl is 8192
Creating OrderModel 0
Wl is 11098
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0

Away from a grid point


In [4]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_F.hdf5",
                            "../../libraries/PHOENIX_TRES_F.hdf5",
                            {"temp":6050, "logg":4.75, "Z":-0.25}, {"temp":10, "logg":0.05, "Z": 0.05})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'alpha': (0.0, 0.0), 'temp': (5000, 7000), 'Z': (-1.0, 0.5), 'logg': (2.5, 5.5)}
LA {'alpha': (0.0, 0.0), 'temp': (5000, 6700), 'Z': (-1.0, 0.5), 'logg': (2.5, 5.0)}
Determine Chunk Log: Wl is 8192
Creating OrderModel 0
Wl is 11098
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

In [15]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_submaster.hdf5",
                            "../../libraries/PHOENIX_TRES_6000.hdf5",
                            {"temp":6000, "logg":4.5, "Z":-0.5}, {"temp":5, "logg":0.025, "Z": 0.025})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (3.5, 5.5), 'temp': (5000, 7000), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.40000000000000002)}
LA {'logg': (4.0, 5.0), 'temp': (5900, 6100), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

In [16]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_submaster.hdf5",
                            "../../libraries/PHOENIX_TRES_6000.hdf5",
                            {"temp":6000, "logg":4.5, "Z":-0.5}, {"temp":1, "logg":0.01, "Z": 0.01})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (3.5, 5.5), 'temp': (5000, 7000), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.40000000000000002)}
LA {'logg': (4.0, 5.0), 'temp': (5900, 6100), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

Perturbations about T=4000, logg=4.5, Z= -0.5


In [13]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_LkCa15.hdf5",
                            "../../libraries/PHOENIX_TRES_4000.hdf5",
                            {"temp":4000, "logg":4.0, "Z":-0.5}, {"temp":10, "logg":0.05, "Z": 0.05})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (2.5, 5.5), 'temp': (4000, 6000), 'Z': (-1.0, 0.5), 'alpha': (0.0, 0.0)}
LA {'logg': (4.0, 5.0), 'temp': (4000, 4100), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

In [17]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_LkCa15.hdf5",
                            "../../libraries/PHOENIX_TRES_4000.hdf5",
                            {"temp":4000, "logg":4.0, "Z":-0.5}, {"temp":5, "logg":0.025, "Z": 0.025})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (2.5, 5.5), 'temp': (4000, 6000), 'Z': (-1.0, 0.5), 'alpha': (0.0, 0.0)}
LA {'logg': (4.0, 5.0), 'temp': (4000, 4100), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

Measured in order 23

It seems like at this stage, with the Mg b lines, that metallicity contributes to the greatest change in the spectrum.

  • Temperature is 0.7%
  • logg is 1.8%
  • Metallicity is 3.7%

So this is interesting, a 1.5% change in flux level corresponds to a 0.05 dex change in metallicity.

Measured in order 23

  • Temperature change is about 2.0%
  • Logg change is 2.5%
  • Metallicity change is 5%

Perturbations about T=2300, logg=4.0, Z= 0.0


In [14]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_M.hdf5",
                            "../../libraries/PHOENIX_TRES_2300.hdf5",
                            {"temp":2300, "logg":4.0, "Z":-0.5}, {"temp":10, "logg":0.05, "Z": 0.05})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (2.5, 5.5), 'temp': (2300, 5000), 'Z': (-1.0, 0.5), 'alpha': (0.0, 0.0)}
LA {'logg': (4.0, 5.0), 'temp': (2300, 2400), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

In [18]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_M.hdf5",
                            "../../libraries/PHOENIX_TRES_2300.hdf5",
                            {"temp":2300, "logg":4.0, "Z":-0.5}, {"temp":5, "logg":0.025, "Z": 0.025})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (2.5, 5.5), 'temp': (2300, 5000), 'Z': (-1.0, 0.5), 'alpha': (0.0, 0.0)}
LA {'logg': (4.0, 5.0), 'temp': (2300, 2400), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

In [19]:
myComp = AccuracyComparison(myDataSpectrum, myInstrument, "../../libraries/PHOENIX_M.hdf5",
                            "../../libraries/PHOENIX_TRES_2300.hdf5",
                            {"temp":2300, "logg":4.0, "Z":-0.5}, {"temp":1, "logg":0.01, "Z": 0.01})

fig = myComp.plot_quality()
display(fig)


Bounds of the grids are
HA {'logg': (2.5, 5.5), 'temp': (2300, 5000), 'Z': (-1.0, 0.5), 'alpha': (0.0, 0.0)}
LA {'logg': (4.0, 5.0), 'temp': (2300, 2400), 'Z': (-1.0, 0.0), 'alpha': (0.0, 0.0)}
ss is len 2755
Creating OrderModel 0
Grid stretches from 5134.978696599707 to 5235.9293774845055
wl_FFT is 0.0480588375883031 km/s
Creating OrderModel 0
interpolated fl is len 5509
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common
Deallocating Covariance Matrix
Deallocating GlobalCovarianceMatrix
Deallocating Common

Measured in order 23

  • Temperature change is 10%
  • Logg change is 7%
  • Metallicity change is 10%

Measured in order 41

  • Temperature change is 4%
  • Logg change is 5%
  • Metallicity change is 5%

Checking that approximate schemes still work

The previous difference spectra were determined using our most accurate implementation of the spectrum modifier yet, that means using the full-resolution PHOENIX grids and k=5 polynomials, such that the spectra are accurate to within floating point precision. Since we have interpolated near a grid point, this also means that any linear approximation to the spline interpolation should be accurate enough.

To test any new approximate scheme for generating spectra, we want to see whether the residual spectrum will be bounded by the smallest spectrum in the {temp, logg, Z} trio, meaning that any error in the approximation will at most contribute to 10% error in any of {temp, logg, Z}. We can increase this threshold if it makes sense.


In [ ]: